Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Jan 21, 2026

continue;
}

if (!$itemType->isString()->no() && !$itemType->isConstantScalarValue()->yes()) {
Copy link
Contributor

@VincentLanglet VincentLanglet Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like you're creating lot of weird inferences:

  • 'foo'|int will be resume to string|int`
  • 'non-empty-string|int' lose the non-empty accessory (same for non-falsy)

Same for 'foo'|positive-int or 'non-falsy-string|positive-int' ; if later casted to array they both are non-falsy while it's not the case if they are resumed to a simple int|string.

Then I'm unsure if this fix is doing more good than bad and shouldn't wait for a more general bugfix (?), cf phpstan/phpstan#13996 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

array_count_values array key inference broken since 2.1.34

2 participants